package com.tcheung.utils;

import java.io.IOException;
import java.util.Properties;

/**
 * 获取属性工具类
 *
 * @author: zhangteng
 * @time: 2014/11/29 17:34
 */
public final class PropertiesUtils {

    private  Properties internalProperties = new Properties();

    public PropertiesUtils() {
        try {
            loadProperties();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void loadProperties() throws IOException {
        Properties prop = new Properties();
        prop.load(IOUtil.getFileAsStream("classpath:root.properties"));
        internalProperties.putAll(prop);
    }

    public String getProperty(String name) {
        return internalProperties.getProperty(name);
    }

}
